package com.wecon.dianping.controller;

import com.wecon.dianping.common.CommonResult;
import com.wecon.dianping.model.Category;
import com.wecon.dianping.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Weikang  Wang
 * @program: com.wecon.dianping.controller
 * @description:
 * @date 2020/3/17 17:20
 */
@RestController(value = "/category")
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 获取品类列表
     * @return /
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public CommonResult getCategoryList() {
        List<Category> categoryList = categoryService.selectAll();
        return CommonResult.create(categoryList);
    }

}
